<!DOCTYPE html>
<html xmlns:ng="http://angularjs.org" id="ng-app" ng-app="playgroundApp">
  <head>
    <title>Cloud Playground</title>
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="/codemirror/lib/codemirror.css">
    <link rel="stylesheet" href="/playground/css/kd.css">
    <link rel="stylesheet" href="/playground/css/app.css">
    <!-- load angular in head section to ensure ngCloak CSS is loaded -->
<!--[if !IE]><!-->
    <script src="/playground/lib/angular/angular.js"></script>
    <script src="/playground/lib/angular/angular-route.js"></script>
    <script src="/playground/lib/angular-ui/angular-ui.js"></script>

    <script src="/codemirror/lib/codemirror.js"></script>

    <script src="/codemirror/mode/clike/clike.js"></script>
    <script src="/codemirror/mode/css/css.js"></script>
    <script src="/codemirror/mode/go/go.js"></script>
    <script src="/codemirror/mode/htmlmixed/htmlmixed.js"></script>
    <script src="/codemirror/mode/javascript/javascript.js"></script>
    <script src="/codemirror/mode/sql/sql.js"></script>
    <script src="/codemirror/mode/php/php.js"></script>
    <script src="/codemirror/mode/python/python.js"></script>
    <script src="/codemirror/mode/shell/shell.js"></script>
    <script src="/codemirror/mode/xml/xml.js"></script>
    <script src="/codemirror/mode/yaml/yaml.js"></script>

    <script src="/codemirror/addon/edit/matchbrackets.js"></script>
<!--<![endif]-->
  </head>
  <body ng-cloak ng-controller="PageController" ng-class="{iframed: iframed}">

<!--[if IE]>
    <div class="cover-everything lightbox">
      <div class="lightbox-msg">
        <p>Sorry, the Cloud Playground is not compatible with this version of
         Internet Explorer.</p>
      </div>
    </div>
<![endif]-->

<!--[if !IE]><!-->
    <!-- full screen lightbox for general initializaiton problems -->
    <div class="cover-everything lightbox" ng-show="load_state && load_state != true" ng-switch="load_state">

      <div class="lightbox-msg" ng-switch-when="IFRAMED_NO_COOKIE">
        Try App Engine in the <button class="btn" ng-click="popout_ide('{{load_state}}')">
        <i class="icon-fullscreen"></i> Cloud Playground</button>
      </div>

      <div class="lightbox-msg" ng-switch-when="NO_BROWSER_COOKIE">
        <p><b>Cloud Playground is unable to use browser cookies.</b></p>
        <div class="text-left">
          <p>Here are some other things you can try to resolve this:
            <ol>
              <li><a ng-click="reload('{{load_state}}')">Reload</a> this page.</li>
              <li>Make sure your browser is configured to allow cookies.</li>
              <li>Clear your browser cookies.</li>
            </ol>
          </p>
        </div>
      </div>

      <div class="lightbox-msg" ng-switch-when="TEMPLATE_NOT_YET_AVAILABLE">
        <p>Loading the requested template...</p>
        <p>Please wait 10 seconds and then <a ng-click="reload('{{load_state}}')">reload</a>.</p>
      </div>

      <div class="lightbox-msg" ng-switch-when="PROJECT_NOT_FOUND">
        <p>Project no longer exists.</p>
        <p>Return to the <a ng-click="to_main_page('{{load_state}}')">Cloud Playground</a>.</p>
      </div>

      <div class="lightbox-msg" ng-switch-when="PROJECT_ACCESS_DENIED">
        <p>Project access denied.</p>
        <p>Return to the <a ng-click="to_main_page('{{load_state}}')">Cloud Playground</a>.</p>
      </div>

      <div class="lightbox-msg" ng-switch-default>
        <p>Unexpected error. Try <a ng-click="reload('{{load_state}}')">reloading</a> this page.</p>
        <div ng-show="load_state.status && load_state.data && load_state.config.method && load_state.config.url" class="text-left">
          <p><pre>{{load_state.status}} &lt;- {{load_state.config.method}} {{load_state.config.url}}</pre></p>
          <p><pre>{{load_state.data}}</pre></p>
        </div>
        <div>
          <p><pre>{{load_state}}</pre></p>
        </div>
      </div>

    </div>


    <div id="container" ng-class="{iframed: iframed}">

      <!-- cover up IFRAMEs during drag -->
      <div id="drag-div" class="cover-everything hidden">
      </div>

      <div id="header" ng-controller="HeaderController" ng-show="load_state == true">
        <div ng-hide="iframed">
          <img src="/playground/img/developers-logo.png" class="header-logo"/>
          <div class="header-logo-line">
            <a ng-click="to_main_page('header-logo')" class="header-product-text"><span class='app-back' pg-visible="!alreadyhome()">&#x2039;</span>Cloud Playground</a>
            <sup class="experimental">experimental</sup>
          </div>
          <div class="topbar" ng-show="config">
            <div class="email">
              <span ng-show="config.is_logged_in"><span ng-show="config.is_admin">[admin] </span>{{config.email}}</span>
              <button ng-show="config.is_logged_in" class="btn login-button" ng-click="signout('sign-out-button')">Sign out</button>
              <button ng-hide="config.is_logged_in" class="btn btn-danger login-button" ng-click="signin('sign-in-button')">SIGN IN</button>
            </div>
          </div>
        </div>

        <div class="text-center notsafe" ng-show="!iframed && load_state == true && !read_only">
          Note this playground is public and may be modified by anyone.
          Don't place sensitive source code or data here.
        </div>

      </div>


      <div ng-controller="AlertController">
        <!-- use ALERT here so CLOSE attribute triggers close widget -->
        <alert ng-repeat="alert in alerts()" close="closeAlert($index)" class="alert-{{alert.type}} alert-pre alert-reduced-margin"><i class="{{alert.icon}}"></i> {{alert.msg}}</alert>
      </div>

      <div id="main" ng-show="load_state==true">
        <div ng-view></div>
      </div>

      <div ng-show="load_state == false" style="padding: 2em;">
        <div class="loading">Loading. Please wait...</div>
        <div class="status">{{status}}</div>
      </div>

      <div id="footer" ng-show="!iframed && load_state == true">
        <div class="diag">
          <span>namespace: {{namespace()}}</span>
        </div>
        <div class="adminlinks">
          <span>git(<a class="link" ng-click="open_git_project('page-footer')">cloud-playground</a>)</span>

          <span ng-show="config.is_admin">danger(<a class="link" ng-click="big_red_button('page-footer')">big-red-button</a>)</span>

          <span ng-show="config.is_admin">oauth2(<a class="link" ng-click="prompt_oauth2_admin('github', 'https://github.com/settings/applications/38287', 'page-footer')">github</a>)</span>

          <span ng-show="config.is_admin || config.is_devappserver">
            admin(<a class="link" ng-click="open_datastore_admin('page-footer')" target="_blank">datastore</a>,
                  <a class="link" ng-click="open_memcache_admin('page-footer')" target="_blank">memcache</a>)
          </span>

        </div>
      </div>
    </div>

    <script src='/ui-bootstrap/ui-bootstrap-tpls-0.1.0.js'></script>
    <script src="/playground/js/app.js"></script>
    <script src="/playground/js/services.js"></script>
    <script src="/playground/js/controllers.js"></script>
    <script src="/playground/js/filters.js"></script>
    <script src="/playground/js/directives.js"></script>
<!--<![endif]-->

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-34864136-2', 'cloud-playground.appspot.com',
     {'allowLinker': true});
  ga('create', 'UA-36037335-1', 'cloud-playground.appspot.com',
     {'name': 'console', 'allowLinker': true});

  ga(function() {
    var trackers = ga.getAll();
    for (var index = 0; index < trackers.length; index++) {
      trackers[index].send('pageview');
    }
  });
</script>
  </body>
</html>
